<!DOCTYPE html>

<!--[if IE 8]> <html lang="en" class="ie8"> <![endif]-->

<!--[if IE 9]> <html lang="en" class="ie9"> <![endif]-->

<!--[if !IE]><!--> <html lang="en"> <!--<![endif]-->

<!-- BEGIN HEAD -->

<head>
    <base href="/hxhmanage/"/>
    <meta charset="utf-8" />

    <title>好洗欢管理平台</title>

    <meta content="width=device-width, initial-scale=1.0" name="viewport" />

    <meta content="" name="description" />

    <meta content="" name="author" />

    <!-- BEGIN GLOBAL MANDATORY STYLES -->

    <link href="css/vendor/bootstrap.min.css" rel="stylesheet" type="text/css"/>

    <link href="css/vendor/bootstrap-responsive.min.css" rel="stylesheet" type="text/css"/>

    <link href="css/vendor/font-awesome.min.css" rel="stylesheet" type="text/css"/>

    <link href="css/vendor/style-metro.css" rel="stylesheet" type="text/css"/>

    <link href="css/vendor/style.css" rel="stylesheet" type="text/css"/>

    <link href="css/vendor/style-responsive.css" rel="stylesheet" type="text/css"/>

    <link href="css/vendor/default.css" rel="stylesheet" type="text/css" id="style_color"/>

    <link href="css/vendor/uniform.default.css" rel="stylesheet" type="text/css"/>

    <!-- END GLOBAL MANDATORY STYLES -->

    <!-- BEGIN PAGE LEVEL STYLES -->
    <link rel="stylesheet" type="text/css" href="css/vendor/bootstrap-toggle-buttons.css" />

    <link rel="stylesheet" type="text/css" href="css/vendor/select2_metro.css" />

    <link rel="stylesheet" href="css/vendor/DT_bootstrap.css" />

    <!-- END PAGE LEVEL STYLES -->

    <link rel="shortcut icon" href="images/logo.png" />

</head>
<body class="page-header-fixed page-sidebar-closed">
<!-- BEGIN HEADER -->

<div class="header navbar navbar-inverse navbar-fixed-top">

    <!-- BEGIN TOP NAVIGATION BAR -->

    <div class="navbar-inner">

        <div class="container-fluid">

            <!-- BEGIN LOGO -->

            <a class="brand" href="index.html" style="padding:0px;">

                <img src="images/logo.png" alt="logo" />

            </a>

            <!-- END LOGO -->

            <!-- BEGIN RESPONSIVE MENU TOGGLER -->

            <a href="javascript:;" class="btn-navbar collapsed" data-toggle="collapse" data-target=".nav-collapse">

                <img src="images/menu-toggler.png" alt="" />

            </a>

            <!-- END RESPONSIVE MENU TOGGLER -->

            <!-- BEGIN TOP NAVIGATION MENU -->



            <!-- END TOP NAVIGATION MENU -->

        </div>

    </div>

    <!-- END TOP NAVIGATION BAR -->

</div>
<!-- BEGIN CONTAINER -->

<div class="page-container row-fluid">

    <!-- BEGIN SIDEBAR -->

    <div class="page-sidebar nav-collapse collapse">

        <!-- BEGIN SIDEBAR MENU -->

        <ul class="page-sidebar-menu">

            <li>

                <!-- BEGIN SIDEBAR TOGGLER BUTTON -->

                <div class="sidebar-toggler hidden-phone"></div>

                <!-- BEGIN SIDEBAR TOGGLER BUTTON -->

            </li>



            <li>

                <a href="indexAction!setStrutsPage.action?pageFlag=order/ordermana.html">

                    <i class="icon-file-text"></i>

                    <span class="title">订单管理</span>

                </a>

            </li>
            <li >

                <a href="indexAction!setStrutsPage.action?pageFlag=community/communityList.html">

                    <i class="icon-home"></i>

                    <span class="title">地址管理</span>

                </a>

            </li>

            <li class="active ">

                <a href="indexAction!setStrutsPage.action?pageFlag=diser/disermana.html">

                    <i class="icon-user-md"></i>

                    <span class="title">配送人员管理</span>

                </a>

            </li>

            <li >

                <a href="indexAction!setStrutsPage.action?pageFlag=pro/product.html">

                    <i class="icon-barcode"></i>

                    <span class="title">产品管理</span>

                </a>

            </li>


        </ul>

        <!-- END SIDEBAR MENU -->

    </div>

    <!-- END SIDEBAR -->

    <!-- BEGIN PAGE -->

    <div class="page-content">

        <!-- BEGIN SAMPLE PORTLET CONFIGURATION MODAL FORM-->

        <div id="portlet-config" class="modal hide">

            <div class="modal-header">

                <button data-dismiss="modal" class="close" type="button"></button>

                <h3>portlet Settings</h3>

            </div>

            <div class="modal-body">

                <p>Here will be a configuration form</p>

            </div>

        </div>

        <!-- END SAMPLE PORTLET CONFIGURATION MODAL FORM-->

        <!-- BEGIN PAGE CONTAINER-->

        <div class="container-fluid">

            <!-- BEGIN PAGE HEADER-->

            <div class="row-fluid">

                <div class="span12">


                </div>

            </div>

            <!-- END PAGE HEADER-->

            <!-- BEGIN PAGE CONTENT-->

            <div class="row-fluid">

                <div class="span12">

                    <!-- BEGIN EXAMPLE TABLE PORTLET-->

                    <div class="portlet box light-grey">

                        <div class="portlet-title">

                            <div class="caption"><i class="icon-globe"></i>配送人员管理</div>

                            <div class="tools">

                                <a href="javascript:;" class="collapse"></a>

                                <!--<a href="#portlet-config" data-toggle="modal" class="config"></a>-->

                                <!--<a href="javascript:;" class="reload"></a>-->

                                <!--<a href="javascript:;" class="remove"></a>-->

                            </div>

                        </div>

                        <div class="portlet-body">
                        <!--    <div class="span12 booking-search">-->
                                <div class="control-group span4">

                                    <label>工号</label>

                                    <div class="input-icon left">

                                        <i class="icon-tag"></i>

                                        <input class="m-wrap" id="workNum" type="text" placeholder="HXH......">

                                    </div>

                                </div>

                                <div class="control-group span4">

                                    <label>姓名</label>

                                    <div class="input-icon left">

                                        <i class="icon-user"></i>

                                        <input class="m-wrap" id="diserName" type="text" placeholder="">

                                    </div>

                                </div>

                                <div class="control-group span4">

                                    <label>配送人员手机</label>

                                    <div class="input-icon left">

                                        <i class="icon-user"></i>

                                        <input class="m-wrap" id="phone" type="text" placeholder="">

                                    </div>

                                </div>


                                <div class="control-group">
                                    <button id="searchBtn" class="btn blue btn-block">搜索 <i class="m-icon-swapright m-icon-white"></i></button>
                                </div>

                            <div class="btn-group" style="font-size: 15px;">

                                <a class="btn red" data-toggle="modal" id="editDiserDIV">添加 <i class="icon-plus"></i></a>

                            </div>

                            <table class="table table-striped table-bordered table-hover" id="sample_1">

                                <thead>

                                <tr>

                                    <th style="width:8px;"><input type="checkbox" class="group-checkable" data-set="#sample_1 div span .checkboxes" /></th>

                                    <th class="hidden-480">工号</th>

                                    <th class="hidden-480">姓名</th>

                                    <th class="hidden-480">配送人员手机</th>

                                    <th class="hidden-480">形象照片</th>

                                    <th class="hidden-480">状态</th>

                                    <th class="hidden-480">操作</th>
                      <!--              <th class="hidden-480">Edit</th>
                                    <th class="hidden-480">Delete</th>
-->
                                    <!--<th ></th>-->

                                </tr>

                                </thead>

                            </table>

<!--                    </div>-->

                    </div>

                    <!-- END EXAMPLE TABLE PORTLET-->

                </div>

            </div>



            <!-- END PAGE CONTENT-->

        </div>

        <!-- END PAGE CONTAINER-->

    </div>

    <!-- END PAGE -->

</div>

<!-- BEGIN FOOTER -->

<div class="footer">

    <div class="footer-inner">



    </div>

    <div class="footer-tools">

			<span class="go-top">

			<i class="icon-angle-up"></i>

			</span>

    </div>

</div>


<audio id="soundPlay" src="" style="display: none;" controls="controls">

</audio>



<div id="addDiser" class="modal hide fade" tabindex="-1" data-width="760">

    <form id="diserForm" class="form-horizontal"  action="//jquery-file-upload.appspot.com/" method="POST" enctype="multipart/form-data">
        <input type="hidden" name="disId">
        <input type="hidden" name="workNum">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
            <h3>添加配送人员</h3>
        </div>
        <div class="modal-body">
          <div class="control-group">

                <label class="control-label">姓名</label>

                <div class="controls">

                    <input name="disName" type="text" class="m-wrap medium" />

                </div>

            </div>

            <div class="control-group">

                <label class="control-label">手机号码</label>

                <div class="controls">

                    <input name="disPhone" type="text" class="m-wrap medium" />

                </div>

            </div>
            <div class="control-group">

                <label class="control-label">形象照片</label>

                <div>
                    <button type="button" class="am-btn am-btn-primary am-btn-xs" onclick="$('#fileUpAdd').click();">
                        上传图片
                    </button>

                    <input type="hidden" id ="fileNameAdd" name="fileNameAdd">

                    <input type='file' id='fileUpAdd' name='fileUpAdd' onchange="uploadFileAdd();" style="display: none;"/>
                </div>
                <div id="imagesAdd">
                    <div style="float:center;">
                        <div>
                            <a ><img id="diserImagesAdd" style="width: 100px;height: 100px;" alt=""/></a>
                        </div>
                    </div>
                </div>
            </div>

            </div>
        <div class="modal-footer">

            <button type="button" data-dismiss="modal" class="btn">关闭</button>

            <button id="addDiserBtn" type="button" class="btn blue"><i class="icon-ok"></i> 保存</button>

        </div>

    </form>

</div>


<div id="updateDiser" class="modal hide fade" tabindex="-1" data-width="760">

    <form id="diserUpdateForm" class="form-horizontal"  action="//jquery-file-upload.appspot.com/" method="POST" enctype="multipart/form-data">
        <input type="hidden" name="disId">
        <input type="hidden" name="workNum">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
            <h3>添加配送人员</h3>
        </div>
        <div class="modal-body">

            <div class="control-group">

                <label class="control-label">工号</label>

                <div class="controls">

                    <input name="workNum" type="text" class="m-wrap medium" disabled/>

                </div>

            </div>

            <div class="control-group">

                <label class="control-label">姓名</label>

                <div class="controls">

                    <input name="disName" type="text" class="m-wrap medium" />

                </div>

            </div>

            <div class="control-group">

                <label class="control-label">手机号码</label>

                <div class="controls">

                    <input name="disPhone" type="text" class="m-wrap medium" />

                </div>

            </div>

            <div class="control-group">

                <label class="control-label">形象照片</label>

                <div>
                    <button type="button" class="am-btn am-btn-primary am-btn-xs" onclick="$('#fileUp').click();">
                        上传图片
                    </button>

                    <input type="hidden" id ="fileName" name="fileName">

                    <input type='file' id='fileUp' name='fileUp' onchange="uploadFile();" style="display: none;"/>
                 </div>

                <div id="images">
                    <div style="float:center;">
                        <div>
                            <a ><img id="diserImages" style="width: 100px;height: 100px;" alt=""/></a>
                        </div>
                    </div>
                </div>
            </div>

        <!--    <div class="control-group">

                <label class="control-label">状态</label>

                <div class="controls">

                    <select id="disStatus" name="disStatus" type="text" class="m-wrap medium" />

                        <option value="1">启用</option>
                        <option value="2">不启用</option>

                    </select>
                </div>

            </div>-->

            <div class="control-group">

                <label class="control-label">状态</label>

                <div class="controls">

                    <div id="disStatus" class="basic-toggle-button">

                        <input type="checkbox" class="toggle" checked="checked"/>

                    </div>
                </div>

            </div>

            <input type="hidden" name="disStatus" isCheckbox="true" value="1"/>
            <!--  <div class="control-group">

                  <label class="control-label">城市</label>

                  <div class="controls">

                      <input name="diserCity" type="text" class="m-wrap medium" />

                  </div>

              </div>
              <div class="control-group">

                  <label class="control-label">小区</label>

                  <div class="controls">

                      <input name="diserComm" type="text" class="m-wrap medium" />

                  </div>

              </div>-->

        </div>

        <div class="modal-footer">

            <button type="button" data-dismiss="modal" class="btn">关闭</button>

            <button id="updateDiserBtn" type="button" class="btn blue"><i class="icon-ok"></i> 保存</button>

        </div>

    </form>

</div>

<div id="popConfirmMsg" class="modal hide fade" tabindex="-1" data-backdrop="static" data-keyboard="false">

    <div class="modal-body">

        <p>确定删除配送人员？</p>

    </div>

    <div class="modal-footer">

        <button type="button" data-dismiss="modal" class="btn">取消</button>
        <button id="delBtn" type="button" data-dismiss="modal" class="btn red">删除</button>

    </div>

</div>
<div id="popMsg" class="modal hide fade" tabindex="-1" data-backdrop="static" data-keyboard="false">

    <div class="modal-body">

        <p>添加成功</p>

    </div>

    <div class="modal-footer">

        <button type="button" data-dismiss="modal" class="btn">确定</button>

    </div>

</div>

<!-- END FOOTER -->

<!-- END CONTAINER -->


<!-- BEGIN JAVASCRIPTS(Load javascripts at bottom, this will reduce page load time) -->

<!-- BEGIN CORE PLUGINS -->

<script src="js/vendor/jquery-1.10.1.min.js" type="text/javascript"></script>

<script src="js/vendor/jquery-migrate-1.2.1.min.js" type="text/javascript"></script>

<!-- IMPORTANT! Load jquery-ui-1.10.1.custom.min.js before bootstrap.min.js to fix bootstrap tooltip conflict with jquery ui tooltip -->

<script src="js/vendor/jquery-ui-1.10.1.custom.min.js" type="text/javascript"></script>

<script src="js/vendor/bootstrap.min.js" type="text/javascript"></script>

<!--[if lt IE 9]>

<script src="js/vendor/excanvas.min.js"></script>

<script src="js/vendor/respond.min.js"></script>

<![endif]-->

<script src="js/vendor/jquery.slimscroll.min.js" type="text/javascript"></script>

<script src="js/vendor/jquery.blockui.min.js" type="text/javascript"></script>

<script src="js/vendor/jquery.cookie.min.js" type="text/javascript"></script>

<script src="js/vendor/jquery.uniform.min.js" type="text/javascript" ></script>

<!-- END CORE PLUGINS -->

<!-- BEGIN PAGE LEVEL PLUGINS -->

<script type="text/javascript" src="js/vendor/jquery.toggle.buttons.js"></script>
<script type="text/javascript" src="js/vendor/select2.min.js"></script>

<script type="text/javascript" src="js/vendor/jquery.dataTables.js"></script>
<script type="text/javascript" src="js/vendor/jquery.validate.min.js"></script>

<script type="text/javascript" src="js/vendor/DT_bootstrap.js"></script>
<script type="text/javascript" src="js/vendor/fnReloadAjax.js"></script>

<!-- END PAGE LEVEL PLUGINS -->

<!-- BEGIN PAGE LEVEL SCRIPTS -->

<script src="js/common/common.js"></script>

<script src="js/vendor/app.js"></script>

<script src="js/vendor/ajaxfileupload.js"></script>

<script src="diser/js/diser.js"></script>


<script>

    $("#editDiserDIV").unbind("click").one("click",function () {
        $("#diserForm .modal-header h3").html("添加配送人员");
        clearData("diserForm");
        $("#diserImagesAdd").attr("src",'');
        $("#diserForm *").removeClass('error').removeClass('success');
        $("#diserForm").validate().resetForm();
        $("#addDiser").modal('show');
        $("#addDiserBtn").unbind('click').on("click",function (){
            $("#addDiserBtn").unbind('click');
            if (!$("#diserForm").valid()) {
                return ;
            }

            $.ajax({
                type: "POST",
                url:"diserAction!addDiser.action",
                data:$('#diserForm').serialize(),
                dataType:"json",
                error: function(request) {
                 /*   $("#popMsg .modal-body").html('<p>添加失败</p>');
                    $("#popMsg").modal('show') ;*/
                    createAlertMsgMainWin("添加失败");
                },
                success: function(data) {
                    if (data.resultCode==1) {
                        $("#addDiser").modal('hide');
                        createAlertMsgMainWin("添加成功");
                        TableManaged._table.fnReloadAjax();
                    } else {
                        createAlertMsgMainWin("添加失败");
                    }
                }
            });
        });
    });

    function updateDiser () {

        oTable = $('#sample_1').dataTable();
        oTable.$('tr').unbind('click').click(function () {
            oTable.$('tr').unbind('click');
            var data = oTable.fnGetData(this);

            console.log(data);
            loadData("diserUpdateForm",data);
            $("#diserForm .modal-header h3").html("修改配送人员");
            $("#updateDiser").modal("show");
            var str = "Upload/images/"+data.disPhoto;
            $("#diserImages").attr("src",str);
            $("#updateDiserBtn").unbind('click').on("click",function (){
                $("#updateDiserBtn").unbind('click');
                $.ajax({
                    type: "POST",
                    url:"diserAction!updateDiser.action",
                    data:$('#diserUpdateForm').serialize(),
                    dataType:"json",
                    error: function(request) {
                        createAlertMsgMainWin("修改失败");
                    },
                    success: function(data) {
                        if (data.resultCode==1) {
                            $("#updateDiser").modal('hide');
                            createAlertMsgMainWin("修改成功");
                            TableManaged._table.fnReloadAjax();
                        } else {
                            createAlertMsgMainWin("修改失败");
                        }
                    }
                });
            });
        });
    }


    function delDiser(disId) {
        showloading();
        $.post("diserAction!deleteDiser.action",{"disId":disId},function(data){
            var resultCode = data.resultCode;

                if(resultCode==1)
                {
                    closeloading();
                    $('#msgMain_sign').modal('hide');
                    createAlertMsgMainWin("删除成功");
                    TableManaged._table.fnReloadAjax();
                }
                else
                {
                    createAlertMsgMainWin("删除失败");
                }

        },"json");
    }




    function diserDetail(disId) {
        sessionStorage.setItem("disId", disId);
        window.location.href = "indexAction!setStrutsPage.action?pageFlag=diser/diserDetail.html";
    }

    jQuery(document).ready(function() {

        App.init();

        TableManaged.init(1);
        FormValidation.init();

        $('#disStatus').toggleButtons({
            onChange:function (){
                if ($('#disStatus').toggleButtons("status")) {
                    $("input[name=disStatus]").val(1);
                } else {
                    $("input[name=disStatus]").val(2);
                }
            },
            label:{
                enabled: "启用",
                disabled: "停用"
            },
            style: {
                enabled: "success",
                disabled: ""
            }
        });

        $("#searchBtn").unbind("click").one("click",function() {
            TableManaged.init(4);
        });
 /*       $("#addDiserBtn").on("click",function (){

           $.ajax({
                type: "POST",
                url:"diserAction!addDiser.action",
                data:$('#diserForm').serialize(),
                dataType:"json",
                error: function(request) {
                    $("#popMsg .modal-body").html('<p>添加失败</p>');
                    $("#popMsg").modal('show') ;
                },
                success: function(data) {
                    if (data.resultCode==1) {
                        $("#addDiser").modal('hide');
                        $("#popMsg .modal-body").html('<p>添加成功</p>');
                        $("#popMsg").modal('show');
                        TableManaged._table.fnReloadAjax();
                    } else {
                        $("#popMsg .modal-body").html('<p>添加失败</p>');
                        $("#popMsg").modal('show');
                    }
                }
            });
        });*/


         uploadFile = (function () {
            return  function () {
                var fileName =  $("#fileUp").val();
                jQuery.ajaxFileUpload
                (
                        {
                            url: 'diserAction!diserFileUpload.action',
                            data: {"fileName":fileName},
                            secureuri: false,
                            fileElementId: 'fileUp',
                            dataType: 'json',
                            type: 'POST',
                            success: function (data, status) {
                                var str = "Upload/images/"+data.fileName;
                                $("#diserImages").attr("src",str);
                                if(data.fileName == 'exist')
                                    return null;
                                /*   var __html  = '<div style="float:left;"><div><a ><img src="<%=basePath%>Upload/images/'+data.fileName+'" style="width: 200px;height: 100px;" alt=""/></a></div>';
                                 __html += '<div style="padding-left: 50%;">';

                                 __html += '<label class="am-radio am-secondary">';
                                 __html +=  '<input type="radio" name="imgR" value="'+data.fileName+'" data-am-ucheck class="am-ucheck-radio"><span class="am-ucheck-icons"><i class="am-icon-unchecked"></i><i class="am-icon-checked"></i></span>';
                                 __html += '</label>';
                                 __html += '</div>';
                                 __html += '</div>';*/
                                $("#fileName").val(data.fileName);
                             //   jQuery("#images").append();

                            },
                            error: function (data, status, e) {
                                createAlertMsgMainWin(e);
                            }
                        }
                )

                return false;
            }
        })();


        uploadFileAdd = (function () {
            return  function () {
                var fileNameAdd =  $("#fileUpAdd").val();
                jQuery.ajaxFileUpload
                (
                        {
                            url: 'diserAction!diserFileUploadAdd.action',
                            data: {"fileName":fileNameAdd},
                            secureuri: false,
                            fileElementId: 'fileUpAdd',
                            dataType: 'json',
                            type: 'POST',
                            success: function (data, status) {
                              /*  createAlertMsgMainWin("上传成功");*/
                                var str = "Upload/images/"+data.fileName;
                                $("#diserImagesAdd").attr("src",str);
                                if(data.fileName == 'exist')
                                    return null;
                                /*   var __html  = '<div style="float:left;"><div><a ><img src="<%=basePath%>Upload/images/'+data.fileName+'" style="width: 200px;height: 100px;" alt=""/></a></div>';
                                 __html += '<div style="padding-left: 50%;">';

                                 __html += '<label class="am-radio am-secondary">';
                                 __html +=  '<input type="radio" name="imgR" value="'+data.fileName+'" data-am-ucheck class="am-ucheck-radio"><span class="am-ucheck-icons"><i class="am-icon-unchecked"></i><i class="am-icon-checked"></i></span>';
                                 __html += '</label>';
                                 __html += '</div>';
                                 __html += '</div>';*/
                                $("#fileNameAdd").val(data.fileName);
                                //   jQuery("#images").append();

                            },
                            error: function (data, status, e) {
                                createAlertMsgMainWin(e);
                            }
                        }
                )

                return false;
            }
        })();

    });



</script>
</body>
</html>